# Maintainer: Andrew Sun <adsun701@gmail.com>

_realname=crcmod
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
provides=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
conflicts=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
replaces=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
pkgver=1.7
pkgrel=4
pkgdesc="Cyclic Redundancy Check (CRC) implementation in Python (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
url="https://pypi.python.org/pypi/crcmod/"
license=('MIT')
depends=("${MINGW_PACKAGE_PREFIX}-python")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools" "${MINGW_PACKAGE_PREFIX}-cc")
options=('staticlibs' 'strip' '!debug')
source=("https://pypi.python.org/packages/source/c/${_realname}/${_realname}-${pkgver}.tar.gz")
sha256sums=('dc7051a0db5f2bd48665a990d3ec1cc305a466a77358ca4492826f41f283601e')

prepare() {
  cd "${srcdir}"
  cp -r "${_realname}-${pkgver}" "python-build-${CARCH}"
}

build() {
  cd "${srcdir}/python-build-${CARCH}"
  ${MINGW_PREFIX}/bin/python setup.py build
}

package() {
  cd "${srcdir}/python-build-${CARCH}"

  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} \
    --root="${pkgdir}" --optimize=1 --skip-build
}
